package recite.word.client.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import recite.word.client.dto.skin.SetSkinDTO;
import recite.word.client.service.ISkinService;
import recite.word.client.vo.skin.GetSkinAllVO;
import recite.word.service.base.common.request.BaseRequest;
import recite.word.service.base.common.response.ResponseResult;

import java.util.List;

@RestController
@RequestMapping("/client/skin")
@Api(tags = "客户端【皮肤】Controller")
public class SkinController {

    @Autowired
    private ISkinService skinService;

    @PostMapping("/getAll")
    @ApiOperation("获取全部主题颜色")
    public ResponseResult<List<GetSkinAllVO>> getAll(){
        List<GetSkinAllVO> ans = skinService.setDayComplete();
        return ResponseResult.success(ans);
    }

    @PostMapping("/getDefault")
    @ApiOperation("获取默认主题颜色")
    public ResponseResult<GetSkinAllVO> getDefault(){
        GetSkinAllVO ans = skinService.getDefault();
        return ResponseResult.success(ans);
    }

    @PostMapping("/setSkin")
    @ApiOperation("设置主题颜色")
    public ResponseResult setSkin(@RequestBody BaseRequest<SetSkinDTO> dto){
        skinService.setSkin(dto);
        return ResponseResult.success();
    }

    @PostMapping("/getSkin")
    @ApiOperation("获取当前用户主题颜色")
    public ResponseResult<GetSkinAllVO> getSkin() {
        GetSkinAllVO ans = skinService.getSkin();
        return ResponseResult.success(ans);
    }
}
